package net.sxjr.protal.mapconverter;

import net.sxjr.mbg.entity.*;
import net.sxjr.protal.igbuild.params.*;
import net.sxjr.protal.igcadre.params.IgcadreInspectionParams;
import net.sxjr.protal.igcadre.params.igCadrePromoteRecruitParms;
import net.sxjr.protal.igperformancepay.params.IgWangeManageParams;
import net.sxjr.protal.igpuoffice.params.IgCadreRecruitManageParams;
import net.sxjr.protal.igpuoffice.params.IgImportantDecideManageParams;
import net.sxjr.protal.igpuoffice.params.IgImportantProjectManageParams;
import net.sxjr.protal.igpuoffice.params.IgLagerAmountCapitalManageParams;
import net.sxjr.protal.user.dao.UserDao;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author ：cuixc
 * @date ：Created in 2020/12/10 19:17
 * @description：干部提拔任命转换器
 * @modified By：
 */
@Mapper(componentModel = "spring")
public interface Converter {
    Converter INSTANCE = Mappers.getMapper(Converter.class);

    //干部提拔任命

    IgCadrePromoteRecruit parms2dao(igCadrePromoteRecruitParms recruitParms);
    List<igCadrePromoteRecruitParms> cadre2parms(List<IgCadrePromoteRecruit> recruit);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(recruit.getCurrentLink()))")
    @Mapping(target = "id",source = "recruit.cadrePromoteRecruitId")
    igCadrePromoteRecruitParms cadre2parms(IgCadrePromoteRecruit recruit);

    //干部走动
    @Mapping(target = "id",source = "cadreInspection.cadreInspectionId")
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(cadreInspection.getCurrentLink()))")
    IgcadreInspectionParams cadreInspectionDao2Params(IgCadreInspection cadreInspection);
    IgCadreInspection cadreInspectionParams2Dao(IgcadreInspectionParams params);

    @Mapping(source = "employeeId",target = "userId")
    @Mapping(source = "employeeName",target = "userName")
    UserDao employee2UserDao(JbdpEmployee employee);

    List<UserDao> employee2UserDao(List<JbdpEmployee> employee);

    //建设类项目
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(buildProject.getCurrentLink()))")
    @Mapping(target = "id",source = "buildProject.buildProjectId")
    IgBuldProjectParms dao2parms(IgBuildProject buildProject);
    List<IgBuldProjectParms> dao2parms(List<IgBuildProject> buildProject);
    IgBuildProject buildProjectparms2dao(IgBuldProjectParms params);
    List<IgBuildProject> buildProjectparms2dao(List<IgBuldProjectParms> params);


    //建设类 转 合同
    @Mapping(source = "parms.contranctNo",target = "CNo")
    @Mapping(source = "parms.contranctName",target = "CName")
    @Mapping(source = "parms.contranctCheckPerson",target = "CCheckPerson")
    @Mapping(source = "parms.contranctCheckResult",target = "CCheckResult")
    @Mapping(source = "parms.contranctJointlySignPerson",target = "CJointlySignPerson")
    @Mapping(source = "parms.contranctFilePerson",target = "CFilePerson")
    @Mapping(source = "parms.contranctStatus",target = "CStatus")
    @Mapping(source = "parms.contranctSummaryPerson",target = "CSummaryPerson")
    @Mapping(source = "parms.CType",target = "CType")
    @Mapping(source = "parms.CChargePerson",target = "CChargePerson")
    @Mapping(source = "parms.CEndDate",target = "CEndDate")
    @Mapping(source = "parms.CEffectiveDate",target = "CEffectiveDate")
    IgContractManage contractManageparms2dao(IgBuldProjectParms parms);

    @Mapping(source = "parms.contranctNo",target = "CNo")
    @Mapping(source = "parms.contranctName",target = "CName")
    @Mapping(source = "parms.contranctCheckPerson",target = "CCheckPerson")
    @Mapping(source = "parms.contranctCheckResult",target = "CCheckResult")
    @Mapping(source = "parms.contranctJointlySignPerson",target = "CJointlySignPerson")
    @Mapping(source = "parms.contranctFilePerson",target = "CFilePerson")
    @Mapping(source = "parms.contranctStatus",target = "CStatus")
    @Mapping(source = "parms.contranctSummaryPerson",target = "CSummaryPerson")
    @Mapping(source = "parms.CType",target = "CType")
    @Mapping(source = "parms.CChargePerson",target = "CChargePerson")
    @Mapping(source = "parms.CEndDate",target = "CEndDate")
    @Mapping(source = "parms.CEffectiveDate",target = "CEffectiveDate")
    IgContractManage contractManageparms2dao(PurchaseOfficeSuppliesParams parms);

    @Mapping(source = "parms.contranctNo",target = "CNo")
    @Mapping(source = "parms.contranctName",target = "CName")
    @Mapping(source = "parms.contranctCheckPerson",target = "CCheckPerson")
    @Mapping(source = "parms.contranctCheckResult",target = "CCheckResult")
    @Mapping(source = "parms.contranctJointlySignPerson",target = "CJointlySignPerson")
    @Mapping(source = "parms.contranctFilePerson",target = "CFilePerson")
    @Mapping(source = "parms.contranctStatus",target = "CStatus")
    @Mapping(source = "parms.contranctSummaryPerson",target = "CSummaryPerson")
    @Mapping(source = "parms.CType",target = "CType")
    @Mapping(source = "parms.CChargePerson",target = "CChargePerson")
    @Mapping(source = "parms.CEndDate",target = "CEndDate")
    @Mapping(source = "parms.CEffectiveDate",target = "CEffectiveDate")
    IgContractManage contractManageparms2dao(IgPurchaseLogisticServiceParams parms);

    @Mapping(source = "parms.contranctNo",target = "CNo")
    @Mapping(source = "parms.contranctName",target = "CName")
    @Mapping(source = "parms.contranctCheckPerson",target = "CCheckPerson")
    @Mapping(source = "parms.contranctCheckResult",target = "CCheckResult")
    @Mapping(source = "parms.contranctJointlySignPerson",target = "CJointlySignPerson")
    @Mapping(source = "parms.contranctFilePerson",target = "CFilePerson")
    @Mapping(source = "parms.contranctStatus",target = "CStatus")
    @Mapping(source = "parms.contranctSummaryPerson",target = "CSummaryPerson")
    @Mapping(source = "parms.CType",target = "CType")
    @Mapping(source = "parms.CChargePerson",target = "CChargePerson")
    @Mapping(source = "parms.CEndDate",target = "CEndDate")
    @Mapping(source = "parms.CEffectiveDate",target = "CEffectiveDate")
    IgContractManage contractManageparms2dao(IgPurchaseSelfParams parms);

    @Mapping(source = "parms.contranctNo",target = "CNo")
    @Mapping(source = "parms.contranctName",target = "CName")
    @Mapping(source = "parms.contranctCheckPerson",target = "CCheckPerson")
    @Mapping(source = "parms.contranctCheckResult",target = "CCheckResult")
    @Mapping(source = "parms.contranctJointlySignPerson",target = "CJointlySignPerson")
    @Mapping(source = "parms.contranctFilePerson",target = "CFilePerson")
    @Mapping(source = "parms.contranctStatus",target = "CStatus")
    @Mapping(source = "parms.contranctSummaryPerson",target = "CSummaryPerson")
    @Mapping(source = "parms.CType",target = "CType")
    @Mapping(source = "parms.CChargePerson",target = "CChargePerson")
    @Mapping(source = "parms.CEndDate",target = "CEndDate")
    @Mapping(source = "parms.CEffectiveDate",target = "CEffectiveDate")
    IgContractManage contractManageparms2dao(IgServeProjectParams parms);

    //招标管理 -- 建设类
    IgBiddingManage biddingManageParams2Dao(IgBuldProjectParms parms);
    IgBiddingManage biddingManageParams2Dao(IgPurchaseLogisticServiceParams parms);
    IgBiddingManageParms biddingManageDao2Params(IgBiddingManage manage);


    //采购项目管理
    IgPurchaseOfficeSupplies purchaseOfficeSuppliesParams2Dao(PurchaseOfficeSuppliesParams params);
    List<IgPurchaseOfficeSupplies> purchaseOfficeSuppliesParams2Dao(List<PurchaseOfficeSuppliesParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(purchaseOfficeSupplies.getCurrentLink()))")
    @Mapping(target = "id",source = "purchaseOfficeSupplies.serveProjectId")
    PurchaseOfficeSuppliesParams purchaseOfficeSuppliesDao2Params(IgPurchaseOfficeSupplies purchaseOfficeSupplies);
    List<PurchaseOfficeSuppliesParams> purchaseOfficeSuppliesDao2Params(List<IgPurchaseOfficeSupplies> purchaseOfficeSupplies);

    //後勤保障物資採購
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(purchaseLogisticService.getCurrentLink()))")
    @Mapping(target = "id",source = "purchaseLogisticService.unspecialFundProjectId")
    IgPurchaseLogisticServiceParams purchaseLogisticServiceDao2Params(IgPurchaseLogisticService purchaseLogisticService);
    List<IgPurchaseLogisticServiceParams> purchaseLogisticServiceDao2Params(List<IgPurchaseLogisticService> purchaseLogisticService);
    @Mapping(source = "params.id",target = "unspecialFundProjectId")
    IgPurchaseLogisticService purchaseLogisticServiceParams2Dao(IgPurchaseLogisticServiceParams params);
    List<IgPurchaseLogisticService> purchaseLogisticServiceParams2Dao(List<IgPurchaseLogisticServiceParams> params);

    //自採購
    IgPurchaseSelf purchaseSelfParams2Dao(IgPurchaseSelfParams params);
    List<IgPurchaseSelf> purchaseSelfParams2Dao(List<IgPurchaseSelfParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(purchaseSelf.getCurrentLink()))")
    @Mapping(target = "id",source = "purchaseSelf.serveProjectId")
    IgPurchaseSelfParams purchaseSelfDao2Params(IgPurchaseSelf purchaseSelf);
    List<IgPurchaseSelfParams> purchaseSelfDao2Params(List<IgPurchaseSelf> purchaseSelf);

    //服务类
    IgServeProject serveProjectParams2Dao(IgServeProjectParams params);
    List<IgServeProject> serveProjectParams2Dao(List<IgServeProjectParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(serveProject.getCurrentLink()))")
    @Mapping(target = "id",source = "serveProject.serveProjectId")
    IgServeProjectParams serveProjectDao2Params(IgServeProject serveProject);
    List<IgServeProjectParams> serveProjectDao2Params(List<IgServeProject> params);

    //薪酬管理
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(wageManage.getCurrentLink()))")
    @Mapping(target = "id",source = "wageManage.wageManageId")
    IgWangeManageParams wangemanageDao2Params(IgWageManage wageManage);
    List<IgWangeManageParams> wangemanageDao2Params(List<IgWageManage> wageManage);
    @Mapping(source = "params.id",target = "wageManageId")
    IgWageManage wangmanageParams2Dao(IgWangeManageParams params);
    List<IgWageManage> wangmanageParams2Dao(List<IgWangeManageParams> params);

    //重大决策事项 风控
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(manage.getCurrentLink()))")
    @Mapping(target = "id",source = "manage.importantDecideManageId")
    IgImportantDecideManageParams importantDecideManageDao2Params(IgImportantDecideManage manage);
    List<IgImportantDecideManageParams> importantDecideManageDao2Params(List<IgImportantDecideManage> manage);
    IgImportantDecideManage importantDecideManageParams2Dao(IgImportantDecideManageParams params);
    List<IgImportantDecideManage> importantDecideManageParams2Dao(List<IgImportantDecideManageParams> params);

    //重大项目事项风控
    IgImportantProjectManage importantProjectManageParams2Dao(IgImportantProjectManageParams params);
    List<IgImportantProjectManage> importantProjectManageParams2Dao(List<IgImportantProjectManageParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(importantProjectManage.getCurrentLink()))")
    @Mapping(target = "id",source = "importantProjectManage.importantProjectManageId")
    IgImportantProjectManageParams importantProjectManageDao2Params(IgImportantProjectManage importantProjectManage);
    List<IgImportantProjectManageParams> importantProjectManageDao2Params(List<IgImportantProjectManage> importantProjectManage);

    //干部聘用风控
    IgCadreRecruitManage cadreRecruitManageParams2Dao(IgCadreRecruitManageParams params);
    List<IgCadreRecruitManage> cadreRecruitManageParams2Dao(List<IgCadreRecruitManageParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(cadreRecruitManage.getCurrentLink()))")
    @Mapping(target = "id",source = "cadreRecruitManage.cadreRecruitManageId")
    IgCadreRecruitManageParams cadreRecruitManageDao2Params(IgCadreRecruitManage cadreRecruitManage);
    List<IgCadreRecruitManageParams> cadreRecruitManageDao2Params(List<IgCadreRecruitManage> cadreRecruitManage);

    //大额资金风控
    IgLagerAmountCapitalManage lagerAmountCapitalManageParams2Dao(IgLagerAmountCapitalManageParams params);
    List<IgLagerAmountCapitalManage> lagerAmountCapitalManageParams2Dao(List<IgLagerAmountCapitalManageParams> params);
    @Mapping(target = "isHaveNextStep",expression = "java(net.sxjr.protal.user.service.LoginService.isHaveNextStep(manage.getCurrentLink()))")
    @Mapping(target = "id",source = "manage.lagerAmountCapitalManageId")
    IgLagerAmountCapitalManageParams lagerAmountCapitalManageDao2Params(IgLagerAmountCapitalManage manage);
    List<IgLagerAmountCapitalManageParams> lagerAmountCapitalManageDao2Params(List<IgLagerAmountCapitalManage> manages);
}
